//
//  PropertyExpensesListTableViewHeaderView.swift
//  SmartHousekeeper
//
//  Created by 张磊 on 2020/2/21.
//  Copyright © 2020 LS. All rights reserved.
//

import UIKit

class PropertyExpensesListTableViewHeaderView: UIView {

     lazy var addressL : UILabel = {
           let value = UILabel(textColor: RGBColor(r: 99, g: 99, b: 99, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(13)))
           value.text = "绑定房屋地址:株洲市建宁花园小区3栋1002室"
           value.numberOfLines = 2
           return value
       }()
       
    lazy var imgLogo : UIImageView = { // 129 38
        let value = UIImageView(image: UIImage(named: "icon_wxjf"))
        return value
    }()
       lazy var titlelL: UILabel = {
           let value = UILabel(textColor: RGBColor(r: 40, g: 40, b:  40, a: 1), textFont: UIFont.boldSystemFont(ofSize: Adapter(15)))
           value.text = "物业费"
           return value
       }()
       
       lazy var moneyL: UILabel = {
           let value = UILabel(textColor: RGBColor(r: 62, g: 134, b:  230, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(13)))
           value.text = "880.00"
           return value
       }()
       
       
       
   

       lazy var switchV : UISwitch = {
           let value = UISwitch()
           //设置开启状态显示的颜色
           value.onTintColor = RGBColor(r: 62, g: 134, b: 230, a: 1)
           //设置关闭状态的颜色
           value.tintColor = .black
           //滑块上小圆点的颜色
           value.thumbTintColor = .white
           value.isOn = true

           return value
       }()
       
       
       required init?(coder: NSCoder) {
           super.init(coder: coder)
       }
       override init(frame: CGRect) {
           super .init(frame: frame)
           setHeader()
       }
       func setHeader() {
           self.addSubview(addressL)
           addressL.snp.makeConstraints { (make) in
               make.left.equalTo(self).offset(Adapter(30))
               make.right.equalTo(self).offset(-Adapter(30))
               make.top.equalToSuperview().offset(Adapter(5))
               make.height.equalTo(Adapter(35))
           }
           
           let line = UIView()
           line.backgroundColor = RGBColor(r: 114, g: 114, b: 114, a: 1)
           self.addSubview(line)
           line.snp.makeConstraints { (make) in
               make.left.equalTo(self).offset(Adapter(15))
               make.right.equalTo(self).offset(-Adapter(15))
               make.top.equalTo(addressL.snp.bottom).offset(Adapter(15))
               make.height.equalTo(Adapter(0.8))
           }
           
          
        self.addSubview(switchV)
        switchV.snp.makeConstraints { (make) in
            make.top.equalTo(line.snp.bottom).offset(15)
            make.right.equalToSuperview().offset(-Adapter(30))
        }
        
        let aotuPay = UILabel(textColor: RGBColor(r: 40, g: 40, b:  40, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(13)))
        aotuPay.text = "自动代扣"
        self.addSubview(aotuPay)
        aotuPay.snp.makeConstraints { (make) in
            make.centerY.equalTo(switchV)
            make.right.equalTo(switchV.snp.left).offset(-Adapter(10))

        }
        
        
           self.addSubview(imgLogo)
           imgLogo.snp.makeConstraints { (make) in
               make.left.equalTo(self).offset(Adapter(30))
               make.centerY.equalTo(switchV)
               make.size.equalTo(CGSize(width: Adapter(20), height: Adapter(20)));
           }
           
           self.addSubview(titlelL)
           titlelL.snp.makeConstraints { (make) in
               make.left.equalTo(imgLogo.snp.right).offset(Adapter(15))
               make.centerY.equalTo(imgLogo)
               make.height.equalTo(Adapter(Adapter(20)))
           }
           
         
         
           
           
       }

}
